//
//  ChatVC.m
//  JSTest
//
//  Created by 奇林刘 on 2018/9/28.
//  Copyright © 2018年 奇林刘. All rights reserved.
//

#import "ChatVC.h"

@interface ChatVC ()

@property (nonatomic, assign) BOOL canTalk;

@end

@implementation ChatVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.canTalk = YES;
    // Do any additional setup after loading the view.
}

- (void)sendMessage:(EMMessage *)message isNeedUploadFile:(BOOL)isUploadFile {
    if (!self.canTalk) {
        UIAlertController *c = [UIAlertController alertControllerWithTitle:@"拒绝发送" message:@"请付钱" preferredStyle:UIAlertControllerStyleAlert];
        UIAlertAction *a = [UIAlertAction actionWithTitle:@"好！我付！" style:UIAlertActionStyleDefault handler:nil];
        [c addAction:a];
        [self presentViewController:c animated:YES completion:nil];
        return;
    }
    
    UIView *h = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 200)];
    h.backgroundColor = [UIColor cyanColor];
    UILabel *l = [[UILabel alloc] init];
    l.text = @"已接案，您可以向客户询问详细案由";
    [h addSubview:l];
    
    [l mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(h);
    }];
    [self.tableView setTableHeaderView:h];
    [super sendMessage:message isNeedUploadFile:isUploadFile];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
